Contents
Raytrace Evaluation Version

This copy of Raytrace is supplied freely for the purposes of evaluation only. Should you decide that you want to use the program for teaching, demonstration or other purposes you should purchase a licensed copy. For pricing and ordering information contact:

IME Software

P.O. Box 1153,

Toowong QLD 4066,

AUSTRALIA

Phone/Fax: +61 7 3870 2317

Please make this evaluation copy available to others whom you think might be interested in using Raytrace.

Some functions have been disabled in the evaluation copy of Raytrace. These include the ability of save ray diagrams that you create, the undo facility, the print function and the edit functions cut, copy and paste.

Licensed copies of Raytrace come with a comprehensive User's Manual with over 100 pages of step by step illustrated examples.

You can purchase a single user licence or a site licence depending upon your needs. A site licence allows the program to be used on any number of computers within the one organisational area.

Raytrace comes with a 30 day money-back guarantee. This entitles you to examine the documentation for a period of 30 days from the date of receipt and to return the package with the sealed disk intact for a refund.

To learn some of the basics about Raytrace choose on of the following topics:

Introduction

What's new and not in the User's Manual...

Menus


What's new
New features not in the User's Manual

IME Software has a policy of always shipping the most up to date version of Raytrace. Useful suggestions from users are incorporated as quickly as possible but it is impossible to update the printed documentation for every minor upgrade. This section gives you quick access to the new features that have been added since the last edition of the User's Manual was printed:

Defining par-axial elements on centre

New style of element creation

Ability to lock elements in position

New appearances of some objects

Script facility

Unlinking sources

Undo up to 5 operations

Rotate by dragging

Select extended

Quiet snapping

Snaps on Tape Measures

Perpendicular snaps to par-axial axis

Default fertility of projected rays

Colour of "Par-axial" element apertures


Introduction
Introduction to RAYTRACE

Thank you for purchasing Raytrace.

Raytrace calculates the paths followed by light rays passing through two dimensional optical systems of arbitrary complexity. It is intended primarily as a teaching tool but can also be used for practical design of optical systems. All ray paths are calculated using double precision arithmetic and the basic principles of reflection and refraction - no approximations are made. In addition to "real" optical systems, Raytrace can calculate and display the standard thin lens and par-axial spherical mirror approximations that are found in the text books.

Raytrace is sold either as a single user licence or as a site licence. The type of licence is indicated in the opening dialog box. A single user licence means you agree to install and use the program on a single computer at a time. A site licence entitles Raytrace to be used on any number of computers simultaneously within the one organisational area. My philosophy is to make high-quality, useful software available at an affordable price. This can only happen if those who use also pay. Please respect this principle; if you are using a copy within one organisation, move on to another organisation which does not have a copy and want continue using Raytrace or want to use Raytrace at home for your own purposes then please either convince the new organisation to purchase a licensed copy or purchase your own personal copy.

I hope you find Raytrace useful and easy to use. If you have a suggestion for improving Raytrace or a particular application which Raytrace does not quite fulfill then please let me know. I will make every effort to incorporate such suggestions where possible.

I have tested Raytrace extensively but if you do find a bug then please make a note of what the problem is; the exact circumstances under which the problem occurred (including type of computer, hardware and software configuration); the version number and release date of the copy of Raytrace (as displayed in the opening dialog box or by using the File -- About menu item) and send it, preferably with a copy of any relevant Raytrace files to me.

Once again, thanks for your support,

Ian Moore.


Cursor prompt

Raytrace prompts you about the action being performed with the mouse at any given time. The raytrace cursor consists of either: a small box, an arrow or a cross and a word. For example, if Raytrace is expecting you to select an entity (ray or element) then the cursor will consist of a small box and the word "Select". If Raytrace is expecting you to pick the end point of a ray to be drawn then the cursor will consist of an arrow and the word "End". If you are specifying the start point of a ray as snapping to a grid intersection then the cursor consists of the cross and the word "Start".

If the cursor contains a small box then you are expected to select or identify some entity on the screen. For example if snapping to the end of a ray, position the cursor so that the end of the ray is somewhere within the small box then click the primary mouse button.

If the cursor contains an arrow then you are expected to position the tip of the arrow at the point of interest and click the primary mouse button once.

"Arrow" type cursors which prompt you to specify a point have "Grid Snap" counterparts. If the snap to grid option is set then the arrow in the cursor is replaced by a cross. The point you specify will always snap to the grid intersection closest to the centre of the cross.

See also: Snapping


Default fertility of projected rays

Now forward projected rays, by default have their fertility set to Forward Project only, so that they will project across elements they encounter.

Similarly, back projected rays have their default fertility set to Back Project only.

You can manually change the fertility of reflected rays after they have been created to some other setting if you want.


Snapping onto Tape Measures

In previous versions of Raytrace, snaps could only be used on elements and rays. You can now use end, middle and perpendicular snaps on Tape measures.

For example, you could create a tape measure whose ends were snapped to the mid point of an arc and the arc's centre. You could then snap a point source or annotation to the middle of that tape measure - the point that corresponds to the par-axial focus of the arc. Then when the arc was dragged the tape measure and the linked source or annotation would move correctly.


Perpendicular snaps onto par-axial elements

In previous versions of Raytrace a perpendicular snap used on either a thin lens element or a par-axial mirror resulted in the perpendicular being taken relative to the aperture plane of the element.

Now if you choose the a perpendicular snap with cursor positioned over the axis of the par-axial element the perpendicular will be taken relative to the axis not the aperture.

This can be useful for creating "object" or "image" lines using tape measures linked to the ray intersections and a perpendicular snap on the lens axis.


Snapping

Snaps will be familiar to anyone who has used a CAD package. Briefly, they serve two purposes: The first is to enable you to precisely specify or identify a point relative to some part of the ray diagram. The second is to allow linking some object (sources, tape measures and protractors) to points within the diagram so that when the diagram changes the linked objects are updated to reflect the new position of specified points. To make use of a snap, click the secondary mouse button once. For some operations this immediately presents you with a menu containing various types of "snaps". For other operations the snaps are listed in a second level popup which is accessible from the Snaps > item. Alternatively, snaps can be selected by a single key press, see: Snap shortcut keys

Generally you will position the point that you want to snap to, within the select box of the cursor, for example, the end of a line. However in some case, such as snapping to the centre of a circular arc or the focus of a conic segment, you position the select box over the arc or conic segment itself.

There are three snaps where this is not the case:

Ray Intersect Snap

When you choose this item from the snaps menu you must specify the two rays for which you want the intersection. The cursor changes to the Ray 1 select form; select one of the rays. The cursor will then change to the Ray 2 select form. You must hold the control key down when you select the second ray. If you do not then the ray you select is taken as the first ray and the cursor will stay in the Ray 2 select form.

Abs Coords

When you choose this item from the snaps menu a dialog box appears in which you can enter the cartesian coordinates of the point you want. By using this feature you can draw ray diagrams which are perfectly scaled copies of real systems.

Rel Coords

This option allows you to specify a point as a displacement relative to some base point. When you choose this item the cursor changes to the base point form; you must select the base point - you can use a snap to do this if you want - a dialog box then appears and you enter either the cartesian or polar displacement from the base point. For polar displacements the angle is specified in degrees. The dialog box also contains a button, Base = Previous point . If you click on this then the base point is set to the previous point selected. This feature allows you to create and element and specify a vertex relative to the last vertex.

When you specify a snap, Raytrace does not accept the selected point unless the snap is successful. For example, if you specify a centre snap and do not position the cursor over an arc segment when you click the primary mouse button then the snap is unsuccessful and the cursor remains in the centre select form. You can change to another type of snap or you can select None from the snap menu to return to free hand pointing.

Grid Snap

This snap option is slightly different to the others. A small cross is displayed in the cursor rather than a box (in the case of the select cursor the box has small cross arms added to it). A Grid Snap will always succeed, snapping to the grid intersection closest to the point defined by the small cross in the cursor. You do not need to have the grid displayed to use a grid snap. See also: Options -- Show Grid and Options -- Snap to grid

Note that you cannot snap to protractors or annotations.


Snap shortcut keys

You can select a snap using the secondary mouse button and selecting it from the popup menu or simply by pressing a single key:

End snap	---	Press E

Centre snap	--- 	Press C

Tangent snap	--- 	Press T

Mid point snap	--- 	Press M

Focus point	--- 	Press F

Conic Vertex	--- 	Press V

Ray intersection	--- 	Press I

Perpendicular snap	---	Press L

Absolute coords	---	Press A

Relative coords	---	Press R

None	---	Press N

In addition there are two more related short cut keys:

To turn the grid on and off simply press the G key.

To toggle the snap to grid option press the S key.


Function short cut keys

Ray colour change:

Press Shift F2 to cycle the colour of all selected rays through the sequence red-green-blue

Extended select:

Pressing Shift F3 is the same as choosing the menu item Edit -- Select extended

Ray fertility change:

F2 --- Toggles Reflect always option

F3 --- Toggles Reflect if no refraction option

F4 --- Toggles Refract option

F5 --- Toggles Show normal option

F6 --- Toggles Foward project option

F7 --- Toggles Back project option

F8 --- Toggles Parent by reflection option

F9 --- Toggles Parent by refraction option


Show Grid
Menu: Options -- Grid

Raytrace allows you to display a grid as an aid in drawing objects. Check this menu item to display a grid. If the current grid size is unsuitable for the scale to which you have zoomed then the grid will not display - it will display if you later change the zoom scale to one where the grid size is appropriate.

As a short cut you can toggle the display of the grid simply by hitting the G key at any time.

You can snap to the grid intersection points using a grid snap.See also: Options -- Grid size


Grid size
Menu: Options -- Grid size

You can specify the x and y spacing of the drawing aid grid using this menu item. The grid size is specified in drawing units. If you choose a grid spacing which is too small or too large to be displayed meaningfully at the current zoom setting then you will be prompted that the grid will not be displayed. However the grid will still be active at the selected size for snapping purposes. The grid spacings in X and Y directions are independent and it is possible to display only the horizontal or vertical lines if one of the spacings is inappropriate.


Grid snap option
Menu: Options -- Snap to grid

If this option is checked then Raytrace will always snap to the nearest grid intersection as if a grid snap had been selected.

This option can be over-riden by selecting another snap type (including none). You can toggle this option simply by pressing the 'S' key at any time.


Selecting

If the cursor appears as a small box (called the select box) and the word Select then you can select entities for various operations, for example, you can select a refracting element and change its refractive index or drag its shape.

Position the select box so that part of the object that you want to select appears inside the box and click the primary mouse button.

All entities that cross the box will be selected in the one operation.

To select a number of objects hold the control key down while selecting the objects with the primary mouse button.

To clear the selection click on the primary mouse button with the cursor over a blank area of the display (with the control key released).

To select a source select one or more of the rays coming from that source.


Dragging

If you click on the primary mouse button with the select cursor positioned over a drag handle then you can drag the point to a new position. Generally Raytrace will update the ray diagram as you drag the point. See Update on Ray Drag and Update on Element Drag.

If you click on the outline of an object away from a drag handle then you can move the whole object about. For elements, if you hold the control key down as you click then you can drag the individual segment of the element.

To move a group of objects, select them and use the Cut and Paste menu items or use Modify -- Move.

See also: Selecting, Fine drag mode, Ortho drag mode


Sources

Sources are a means of generating groups of rays. Two source types available: point and plane sources.

A source allows a group of rays to be dragged with one operation. Sources can also be linked to elements so that the rays will always strike the element even when it is dragged.

For information on creating a source and more information about sources see: Create -- Source.


Menus
Raytrace Menus

For specific help on a menu item select the top level menu:

File

Edit

Modify

Clear

Zoom

Create

Defaults

Options

Info


Demo version limitations

If you are using a demonstration version there are a number of restrictions which apply:

Maximum number of rays = 20

Maximum number of elements = 1

Maximum number of segments in an element = 4

Maximum number of tape measures = 1

Maximum number of protractors = 1

Maximum number of point sources = 1

Maximum number of plane sources = 1

Menu items:

Print, Create Meta File, Cut, Copy, Paste, Mirror, Rotate, Join and Explode

are all disabled.

If you find Raytrace interesting and useful then please send for a registered copy of the program.


Raytrace limits

The number of entities which can be used in any one model are fixed at:

Maximum number of rays = 200

Maximum number of elements = 50

Maximum number of segments in an element = Unlimited (subject to memory)

Maximum number of tape measures = 10

Maximum number of protractors = 10

Maximum number of point sources = 20

Maximum number of plane sources = 20


File menu
Menu: File

New

Save

Save As

Open

Directories...

Print

Create Metafile

Run script

Quit


New
Menu: File -- New

Selecting this menu item clears the entire contents of the ray diagram and resets some options to their default values. The options that are reset are:

Default ray settings

Child ray settings

Show Red, Green and Blue Rays all checked

Show Rulers, Protractors, Annotations and Trails all checked

Pause Trails unchecked.

If you want to clear the ray diagram without reseting these options then choose All from the Clear menu.

You can recover from using this command with the undo command.


Save
Menu: File -- Save

Choosing this item saves the ray diagram using the name under which it was previously saved or prompts you for a name if it is a new diagram.


Save
Menu: File -- Save As

Select this item to bring up a standard Windows "Save As" dialog box.

Enter the name of the file and click on OK or double click on one of the existing file names displayed in the file list box.

By convention files should be saved with the extension .ray  but this is not necessary - you may use any extension or omit the extension.

You will be prompted if you try and overwrite an existing file.

All default settings and options, including the Raytrace window size and position are saved with the file.


Open
Menu: File -- Open

Select this item to bring up a standard Windows "Open File" dialog box.

Enter the name of the file and click on OK or double click on the filename in the file list box.

You must enter the extension if you type in the filename.

If you meant to save the existing ray diagram before opening a new one then you can recover with the undo command.

All default settings and options are set to those active when the file was saved. This includes the size and position of the Raytrace window.


Directories
Menu: File -- Directories

Selecting this menu item starts a dialog box which allows you to change the directories that Raytrace uses for various purposes. There are three directories that you can change:

System

This is the directory in which Raytrace expects to find the help file RAYTRACE.HLP and the material file RAYTRACE.MAT. It is also the directory which is used by default when selecting an element library file although you can select an element library file from any directory.

Undo

This is the directory in which Raytrace will store the RAYTRACE.UDO file.

Work

This is the default directory that is used when you save or open a ray diagram although you can save or open a file in any directory.

When entering a directory name the final backslash character must be present. For exampleC:\RAYTRACE\ not C:\RAYTRACE

If you leave a directory blank then the current working directory (the one from which Raytrace was started) will be used.

The directories are saved in a file called RAYTRACE.DIR which is created in the directory from which Raytrace is initially run.


Print
Menu: File -- Print

Selecting this menu item will cause Raytrace to print the current view of the ray diagram. A standard Windows print dialog box comes up. The diagram will be scaled so that the visible window fits the page.


Create Metafile
Menu: File -- Create Metafile

Selecting this menu item will cause a windows meta file called raytrace.wmf to be created. The file will contain the meta graphics commands which will draw the visible portion of the ray diagram.


Run script
Menu: File -- Run script

Choosing this menu item lets you open a script file.

Script files are a list of text commands, like a program, which control Raytrace. You can use script files for pre-set demonstrations or to provide instructions to users (students) who must perform a specific task.

The "Quick Tour" is an example of the use of Raytrace scripts.

A script file is a standard ASCII file and you may create your own with your favourite editor. You should be proficient with using Raytrace before you attempt to do this however.

By convention, script files should have an extension ".rsc" but this is not mandatory.

As Raytrace is developed further it is expected that the script facility will be expanded and made easier to use depending upon feedback from users. If you want to make use of the script facility and you need a particular function or some other special requirement then please contact IME Software to discuss the implementation.

The script language is based on single commands on each line. The command syntax is very simple and each command corresponds to a single action in Raytrace. The script language also includes basic calculation facilities.

The first character on each line determines how the line is interpreted:

Any line beginning with the percent character, %, is considered to be a comment and is ignored.

Any line beginning with a period character, ., is considered to be a command (see below).

Any line beginning with a colon character, :, is considered to be a label. The label follows the colon directly, e.g. :LABEL and is delimited by blank space or the end of the line. Labels are used in conjunction with commands like .goto

Any line beginning with any other character (including blank spaces) is considered to be text which will be displayed in the script dialog box. This text should be directed at the person running the script, i.e. instructions on what should be performed or comments on what is happening.

Click on the following to find out more about using scripts.

Script commands


Script commands

The available commands in the script language are listed in sections as shown below. Arguements to the commands are shown in this colour. Optional arguements are enclosed in square brackets. Alternative arguements are separated by the | character.

Any numeric value arguements can generally be replaced by keywords which allow access to user input and mouse click coordinates.

Command categories:

Mouse movement and clicking commands

Create commands

Snap commands

Clear commands

Zoom commands

Calculator commands

Selection commands

Ray fertility commands

Flow control commands

Input commands

Keyboard mimic commands

Grid commands

Edit commands

Ray commands

Measurement tool display options

User control commands

Modify commands

Trail commands

File commands

Miscellaneous commands


Script keywords

Using one of the following in place of a numeric arguement to a script command gives access to special functions:

UserInput  prompts the user to enter a numeric value.

Random  uses a random number uniformly distributed between 0 and 1.

LastClick.x or LastClick.y   uses either the x or y coordinate of the last mouse click.

If left blank the current value in the accumulator (See: Calculator commands) will be used if it is sensible to do so for the particular command.


Script mouse commands

These commands mimic operations that would be performed with the mouse:

Sets limits on mouse movements when using either .allow_drag or .user_click commands. The cursor can be moved outside the defined region but Raytrace will limit its response to points inside the region.

.mouse_limits MinX MinY MaxX MaxY

Move the cursor to x,y (takes about 1 second)

.move x y

Move the cursor to x,y without any delay

.fast_move x y

Move the cursor to x,y and then click primary mouse button. Displays a "Click" cursor as a visual indication. Takes about 1 second.

.click x y

Perform the action that would occur if the primary mouse button was clicked at x,y but doesn't move the cursor.

.fast_click x y

Like .click, .fast_click and .move except the cursor is positioned relative to the last mouse click.

.click_rel x y

.fast_click_rel x y

.move_rel x y

.fast_move_rel x y


Script creation commands

These commands mimic the actions you would perform using items in the Create menu and some other functions that are associated with creating elements:

Same as choosing Create -- Protractor, must be followed by appropriate".click" or ".fast_click" commands

.protractor

Same as choosing Create -- Tape Measure, must be followed by appropriate".click" or ".fast_click" commands

.tapemeasure

Same as choosing Create -- Annotation. Must be followed by appropriate ".click" or ".fast_click" commands.

.annotation text

Create a trail - must be followed by appropriate click type commands.

.trail

Same as  choosing Create -- Element > xxx, must be followed by appropriate".click" or ".fast_click" and ".end_element" commands.

.create_region

.create_surface

.create_shape

Terminate creation of an element.

.end_element

Create converging, diverging lens or paraxial mirror.converging_thinlens

.diverging_thinlens

.paraxial_mirror

Same as  choosing Create -- Ray, must be followed by appropriate".click" or ".fast_click" and ".finish" commands.

.create_ray

Terminate creation of rays.

.finished_rays

Switch to arc segments when creating an element.

.arcseg

Switch to radius/end method of specifying arc segments.

.radius_end

Switch to centre/end method of specifying arc segments.

.centre_end

Switch to chord/tangent method of specifying arc segments.

.chord_tan

For radius/end and centre/end arc creation methods set the direction of the arc.

.clockwise_arc

.anticlockwise_arc

Switch to creating line segments when creating an element.

.lineseg

Switch to creating conic segments when creating an element.

.conicseg

Same as choosing Create -- Source > xxx. Must be followed by appropriate ".click" or ".fast_click" commands.

.point_source

.plane_source

Set the number of rays to be used in a create source type command.

.source_ray_count integer

Set the check state of the Par-axials on centre menu item. If parameter state is non-zero then it is checked.

.par-axials_on_centre state


Script snap commands

These commands give you access to Raytrace's snap options for the next click operation:

.end_snap

.perp_snap

.centre_snap

.mid_snap

.focus_snap

.vertex_snap

.tangent_snap

.intersect_snap

Set the state of the snap to grid option.

.grid_snap state

Set Options -- Quiet snap setting. If paarameter is non zero then item is checked

.quiet_snap state


Script clear commands

These commands perform the same functions as choosing an item from the Clear menu:

.clear_rays

.clear_elements

.clear_tapemeasures

.clear_protractors

.clear_annotations

.clear_trails

There is also the additional command: .clear_all which clears everything from the ray diagram - like .file_new but does not reset the default parameters for some actions.


Script selection commands

These commands operate in the same manner as choosing Edit -- Select All > xxx

.all_rays

.all_elements

.all_tapemeasures

.all_protractors

.all_annotations

.all_trails

You can unselect any selected objects using the command:

.unselect_all

You can unselect all of a particular type of object using the following commands:

.unselect_rays

.unselect_elements

.unselect_tapemeasures

.unselect_protractors

.unselect_annotations

.unselect_trails

Select all objects belonging to a group, see Edit -- Select Group

.select_group

Select using a box, see Edit -- Select Extended

.select_extended

Select all child rays of the selected rays, see Edit -- Select Child rays

.select_child_rays

You can also select an object by using its handle. The handle may be stored in a script variable directly after the creation of the object. For example:

.create_surface

.fast_click 100 100

.fast_click 100 200

.end_element

.=> MIRROR

Stores the handle of the simple reflecting surface in the variable MIRROR. To later select the reflector use the command: .select_object MIRROR

Select an object by a handle (see above). Takes multiple parameters.

.select_object handle1 [handle2] ... [handleN]


Script calculator commands

Raytrace's script facility includes the ability to perform arithmetic operations in much the same manner as with a scientific calculator. See the topic Script calculator syntax for information on the use of these commands and features of the script calculator.

Commands:

Clear a calculator variable (free the memory associated with it so another variable can be defined). You can have up to 50 variables at any one time. If the arguement is omitted then all existing variables are removed.

.clear_var [varname]

Create a new variable with the name varname and assign the current value in the accumulator to it.

.=> varname

Simple arithmetic operations

Trig commands

Log and exponential commands

Comparison and testing commands

Miscellaneous commands:

Randomize the internal random number generator. A random number uniformly distributed between 0 and 1 can be used in place of any numeric operand or command arguement by using the keyword Random in place of the arguement.

.randomize

Prints a number onto the end of the currently displayed text. The format string must be provided and works in the same fashion as C format specifiers. For example a format string of %g will convert the number in the format which is most applicable to the number being printed.

.printf  format [number]


Script arithmetic commands

For binary operators the two operands are the current contents  of the accumulator and the arguement [number]. For unary operators the arguement [number] is used. If [number] is omitted then the contents of the accumulator are used in place of that operand. So for example using .+ without any following arguement will add the contents of the accumulator to itself.

.+  [number]

.-  [number]

./  [number]

.*  [number]

.sqrt  [number]Find square root of number

.1/x  [number]Take reciprocal of number

.x^2  [number]Raise number to power of 2

.deg>rad  [number]Convert degrees to radians

.rad>deg  [number]Convert Radians to degrees

.+/- [number]Change sign of number

.sign [number]Return -1, 0 or 1 depending on sign of number


Script trigonometric commands

.sin  [number]

.cos  [number]

.tan  [number]

.arcsin  [number]

.arccos  [number]

.arctan  [number]

.arctan2  number [number]


Script log and exponential commands

.log_10 [number]

.log_e [number]

.exp [number]

.10^ [number]


Script comparison commands

Arithmetic comparisons. If the result of the comparison is true then the script execution jumps to LABEL otherwise it continues on the next line. Both arguements must be given.

.if!= number LABEL

.if== number LABEL

.if<= number LABEL

.if>= number LABEL

.if< number LABEL

.if> number LABEL

Decrement the named script variable by 1 and if the result is greater than zero jump to LABEL. Used for implementing count controlled loops.

.--if!=0 varname LABEL


Script calculator description

Script calculator commands have the same syntax as other script commands. They must be entered one to a line with an initial period character on the line.

Like a normal calculator, the script calculator has an accumulator. That is a register or storage place which holds the current result - the number which is displayed by a real calculator. You can enter a number into the accumulator simply by using the number like a command. For example the following lines all enter numbers into the accumulator:

.123

.0.123

..123

.1e-6

The results of calculations also end up in the accumulator.

You can name up to 50 script variables for holding results of calculations. To define a variable use the following syntax:

.123.456

.=> VNAME

The assignment command .=>  creates the variable with name VNAME and stores the current contents of the accumulator into it. In this example the number 123.456 would be stored in the variable VNAME.

Once you have defined a variable you can use it in place of numeric arguements to calculator or other script commands or as a script command itself. If used as a script command it puts its value into the accumulator. For example:

.0.32

.=> XVALUE

.0.45

.=> YVALUE

.click XVALUE YVALUE

.XVALUE

.+ 10

.=> XVALUE

In this example the variable XVALUE is initialised to the value 0.32, the variable YVALUE to 0.45 then these are used as arguements to the .click command. Subsequently the value in XVALUE is entered into the accumulator and 10 is added to it before storing the result back in XVALUE.

If you follow a script variable name by a numeric arguement then this stores the number directly into the variable without going via the accumulator. For example, if X is an existing script variable:

.X 456.7

will store 456.7 in X. Note that this will only work if X is already defined. You must use the .=> command to define new variables.


Script zoom commands

These commands perform the same functions as choosing an item from the Zoom menu:

In/Out must be followed by appropriate ".click" or ".fast_click" commands.

.zoom_reset

.zoom_extents

.zoom_in

.zoom_out

.zoom_previous

Like clicking in the scroll bars on the Raytrace window.

.pan_left

.pan_right

.scroll_up

.scroll_down


Script ray fertility commands
Script ray feertility commands

Toggle the fertility of selected rays or if no rays are selected then the default setting for user created rays. Id the parameter state is given then sets the fertility state rather than toggling the existing state.

.reflect [state]

.reflect_if_no_refract [state]

.refract [state]

.normal [state]

.forward_project [state]

.back_project [state]

.parent_reflect [state]

.parent_refract [state]

To change the fertility setting for child rays use the above commands to set the desired fertility then use the command .childray_fertility  which copies the fertility to the default child ray setting. You can then re-set the default user created fertility.


Script miscellaneous input commands

Set the default user input value for subsequent UserInput arguements

.default_input value

Sets the upper and lower limits of the value that the user can enter in response to subsequent UserInput arguements.

.input_limits min max


Script flow control commands

Exit the script dialog box

.close_script

If delay is omitted then wait until the user clicks on the "Continue" button before proceeding. If delay is given then waits "delay" milliseconds.

.pause [delay]

Runs a script named "filename".

.script filename

Calls the script "filename" as a subroutine

.call filename

Returns to the calling script

.return

Specifies the script file which will be activated if the user clicks on the "Previous" button. Do not use in scripts that will be used as subroutines, i.e. those that will end in .return.

.run_from filename

Go to the first occurence of a line beginning ":LABEL" in the current script

.goto LABEL

Present the user with YES and NO buttons to choose from. If YES is chosen then go to the first occurence of :LABELYES otherwise go to :LABELNO. If LABELNO is ommitted and NO is chosen then execution of the script continues sequentially.

.yes_no LABELYES [LABELNO]

Present the user with up to 10 buttons labelled A through J and thenjump to the nth label depending on which button is chosen.

.choose n LABELA ... LABELJ

See also: Script comparison commands


Script keyboard_mimic commands
Script keyboard mimic commands

Set the state of the control and shift keys. Down if state is non zero. Puts state into the accumulator..control_key state

.control_shift state


Script grid commands

Show or hide the grid. If state is non zero then shows the grid.

.grid state

.grid_size x y

Set the state of the snap to grid.

.grid_snap state


Script measurement option commands

Changes the options for selected tape measures. All arguements must be given.

.tapemeasure_options distance_decimals angle_decimals leader|noleader distance|cartesian|degrees|radians|none

Changes the options for selected protracors. All arguements must be given.

.protractor_options decimals leader|noleader degrees|radians|none

Show/hide objects.

.show_protractors state

.show_tapemeasures state

.show_annotations state


Script edit commands

Same as choosing Edit -- Delete

.delete

Same as choosing Edit -- Undo. See also .enable_undo

.undo

Enable/disable the creation of undo files. Speeds running of a script if the undo file is not created after every operation. Has no effect on the operation outside the script.

.enable_undo state

Same as using the Edit -- Cut (Copy) or (Paste) menu items.

.edit_cut

.edit_copy

.edit_paste


Script ray commands

Set the default length for all selected rays or if none selected then for newly created rays.

.set_length x

Change the colour of selected rays or the default colour for new rays.

.red

.green

.blue

Set the state of the Options -- Show > xxx rays menu items.

.red_rays state

.green_rays state

.blue_rays state

Set the three colour wavelengths and optionally modify the refractive indices of all the elements to reflect the new wavelength values. See also Modify -- Wavelengths. If the final optional parameter is not given or is non-zero then the element refractive indices will be modified. The parameters Red, Green and Blue are the wavelengths in nanometres.

.wavelengths Red Green Blue [0]

Cycle the colours of all selected rays one step through the sequence R-G-B. Same as using Shift F2

.cycle_colour

Change the colour of selected rays so that they become red, green and blue in sequence. Use for changing a source into a white ray - hence the name.

.white_ray


Script user control commands

If dragging has been initiated by the script then allow the user to continue the dragging. Clicking the primary mouse button returns to the script without ending the drag operation.

.allow_drag

Allow the user to choose the next clicking point. If the user clicks outside the currently defined mouse limits and the label arguement is given then execution of the script jumps to the LABEL otherwise execution continues with the following line.

.user_click [LABEL]

Passes control to the user who can then use any Raytrace functions. Control returns to the script when the user clicks on the "Continue" button.

.user_control


Script modify commands

If any elements are selected then set their refractive indices to the values specified otherwise set the default values for new elements.

.refractive_index nred ngreen nblue

Same as choosing Modify -- Move. Must be followed by appropriate ".click" or ".fast_click" commands to specify dsplacement.

.move_selection

Same as choosing Modify -- Mirror. Must be followed by appropriate ".click" or ".fast_click" commands to specify mirror line.

.mirror

Same as choosing Modify -- Scale. Must be followed by appropriate ".click" or ".fast_click" command to specify centre of scale operation.

.scale factor

Same as choosing Modify -- Rotate and specifying a fixed rotation angle. Must be followed by appropriate ".click" or ".fast_click" command for the centre of rotation.

.rotate angle

Same as choosing Modify -- Rotate and specify the rotate by drag option. Must be followed by appropriate ".click" or ".fast_click" commands to specify centre and reference direction and then either a ".allow_drag" and/or ".click" command.

.rotate_drag

 Allows you to link segments in the same manner as the menu item Modify -- Link Segments

.link_segments

Sets the option to stretch when segments are linked within a script using the previous command

.link_stretch

Sets the option to stretch when segments are linked within a script

.link_move


Script trail commands

Same as choosing the menu item Modify -- Auto Trace. The option number between 1 and 3 sets what is traced, i.e. centre/base, end1 or end2 for a source or start, end, whole for a ray.

.auto_trace N

Same as choosing Modify -- Reset Trails.

.reset_trails

Same as choosing Modify -- Pause Trail Update.

.pause_trails


Script file commands

Same as selecting File -- New

.file_new

Same as selecting File -- Open and choosing a file called "filename"

.open filename

Same as choosing File -- Save As and specifying "filename".

.save filename


Script misc options commands

Set the source drag option to drag a single ray

.drag_single

Same as using the Options -- Max path depth menu item and entering N.

.max_path_depth N

When dragging the tangent control point of an arc segment, the same as clicking on the secondary mouse button and using "Set arc radius" to set the arc radius to "radius"

.set_radius radius


Script miscellaneous commands

Clears the current text. Subsequent text is only displayed on the nextcommand.

.new_text

Set the state of the menu items Options -- Update on element drag andOptions -- Update on ray drag..update_on_element_drag state

.update_on_ray_drag state

Return the object handle of a ray which is related to the specified ray by the geneology given.

.child_by RAY relationship1 [relationship2] ... [relationshipN]


Exiting RAYTRACE
Menu: File -- Quit (Exiting RAYTRACE)

You may exit Raytrace at any time simply by selecting this menu item or double clicking on the system menu bar at the top left hand corner of the window.

If you inadvertently exit by mistake then you can recover the lost work by immediately selecting the undo menu item when next you run Raytrace.


Edit menu
Menu: Edit

Undo

Delete

Select All >

Select Child Rays

Select Group

Select Extended

Cut

Copy

Paste

Library >


Undo
Menu: Edit -- Undo

Choosing this menu item will "undo" the previous modification of the ray diagram. Up to five operations may be undone.

Most serious operations can be undone, including quitting without saving!

Zooming cannot be undone - use the Zoom -- Previous menu item instead.

The undo operation uses files called raytrace.udx where x is a digit between 0 and 4 do not delete these files while running Raytrace. These files are created or modified whenever you perform some action on the ray diagram. If you are running Raytrace with the undo directory set to a floppy disk then you will notice a significant pause while the files are written. Best advice is: only run Raytrace from a hard disk or at least set the undo directory to one on a hard disk.

Beware that undo also reverses the action of File -- Open but it does not change the filename associated with the ray diagram.


Delete
Menu: Edit -- Delete

Choosing this menu item will delete any selected objects from the ray diagram.

A single level of delete can be undone.

Deleting a ray that you have drawn will delete all the child rays associated with it. Deleting a child ray will have no effect since it will be regenerated by its parent ray. You must change the parent ray fertility (See: Modify -- Rays...) to get rid of any unwanted child rays.

You can simply hit the delete key to perform the same operation as this menu item.


Select All
Menu: Edit -- Select All >

There a five options in this sub-menu, they allow you to select all the rays, elements, tape measures, protractors or trails in the ray diagram. This can be useful for all sorts of things, for example, changing the colour or other default parameters of all the rays in a diagram or changing the refractive index of all the elements in the diagram.


Select extended
Menu: Edit -- Select extended

Choosing this menu lets you select objects within the ray diagram by drawing a rectangular box (in the same manner as a zoom box is drawn). Any objects which lie within or cross the rectangular box will be selected.

A short cut key to this operation is to press Shift F3.


Select Child Rays
Menu: Edit -- Select Child Rays

Causes all the rays that are drawn as a result of the selected rays existance to be selected. This can be useful to calculate path lengths or for copying rays with their fertility structure.


Select Group
Menu: Edit -- Select Group

Select an element and then use this command to select all other elements associated with this group.


Cut
Menu: Edit -- Cut

Copies the selected objects to the clipboard and removes them from the ray diagram. The objects can then be pasted into other ray diagrams or at a different position in the current diagram.

You must select a base point which will be mapped onto the point you pick when you paste the objects back into the diagram.


Copy
Menu: Edit -- Copy

If any objects are selected then this menu item copies them to the clipboard. The objects can then be pasted into other ray diagrams or at a different position in the current diagram.

You must select a base point which will be mapped onto the point you pick when you paste the objects back into the diagram.

If no objects are selected then a copy of the visible portion of the ray diagram is copied into the clipboard - this can then be pasted into other drawing packages or word-processing programs. This cannot be pasted into a ray diagram since it is only a copy of the picture not the information about the objects that all calculation of the ray diagram.


Paste
Menu: Edit -- Paste

Inserts the contents of the clipboard (must have been set by using either copy or cut in Raytrace) into the ray diagram. You must select a point onto which the base point picked when cutting or copying will be mapped.


Library functions
Menu: Edit -- Library

An element library contains a list of elements which have been predefined. You can paste these into your ray diagram rather than having to draw your own elements each time or cut and paste them from other ray diagrams.

There are three items in this submenu concerned with using element libraries:

Paste from...

Save to...

Manager...


Paste from library
Menu: Edit -- Library > Paste from...

This menu item starts the Paste from Library dialog box. To paste an element use the following steps:

Select a library file by press the Change Library ... button and selecting an element library using the "open file" type dialog box. Element libraries have an extension of ".ELB" by convention.

(This step need only be used the first time you use any of the Paste from library, Save to library or Library Manager menu commands in a given Raytrace session or when you want to change to a different library file.)

Once a library file has been selected, the file name will appear at the top left corner of the Paste from Library dialog box and a list of the available elements in the library will appear in the list box on the right hand side. Select the element you want either by clicking on a name in the list box or typing the name into the edit box in the top right hand corner.

If the Show preview check box is checked then a preview drawing of the element will appear in the space on the left hand side of the dialog box. The "start point" of the element is indicated by a small square box on one of the element vertices. This is the point at which the original construction of the element was started and will be the point which is mapped onto the base point you select as outlined below.

Press the Paste button or double click on the name of the element in the list box to paste the element into your ray diagram.

One you have pressed the Paste button the dialog box will minimise itself to a small box containing two buttons: Close and Restore. These are explained below.

To complete the pasting operation you need to select the point in the ray diagram at which the element will be positioned. The element will be positioned so that the point indicated by the small square  box in the preview will be at the point you select here.

To change the size of the element when you paste it, check the Scale on paste check box before pasting the element. In this case you will be prompted (by the cursor) to select two corners of a rectangle in which the element will be scaled to fit. The aspect ratio of the rectangle is constrained to be the same as a rectangle which just contains the element being pasted.

When you paste an element the from Library dialog box shrinks to a smaller dialog box containing just two buttons. This allows you to paste the element with a minimum of clutter on the screen. The small dialog box can be moved so that it does not cover important parts of your ray diagram. When you want to paste another element from the library simply click on the Restore button to make the complete dialog box reappear. If you have finished all the pasting of elements that you want to do then click on the Close button to remove the small version of the dialog box.

If when the preview of the element appears the word Deleted appears in the middle of the preview area this means that the element has been marked to be removed from the element library when next it is purged using the Library Manager. However, you can still paste the element in the manner described above.


Save to library
Menu: Edit -- Library > Save to...

To add an element to an existing element library first select the element in your ray diagram and then select this menu item. A Save to Library dialog box will appear.

If you have not already selected a library file using either the Paste from Library or Library Manager dialog boxes then use the Change library... button to select a library file.

Type the name you wish to use to describe the element into the edit box and press the Save button. You must select a unique name when saving a new element - you will be prompted if you do not.

A list box containing the names of elements already in the library is shown to help you in choosing a unique name, a preview of an existing element will be displayed if you click on a name in the list and the Show preview  check box is checked.


Library manager
Menu: Edit -- Library > Manager...

Use this menu item if you want to modify the contents of a library file in some way other than adding a new element. A dialog box will appear.

If you have not already selected a library file using either the Paste from Library or Save to Library dialog boxes then use the Change library... button to select a library file.

Use the Create Library... button to make a new library file. You might find this useful to keep elements for a particular demonstration or project all together or simply to hold useful elements that you have created yourself. Avoid putting more than a few dozen elements into a single library - you can do it if you want but you will find it easier and quicker to find and paste your elements if they are separated into small logical groups contained in separate files.

To delete an element from the library, click once on its name in the list box or type the name into the edit box then press the Delete button. The element is not deleted at this stage it is simply marked to be removed when the Purge button is pressed.

To change the name of an element click once on its existing name in the list box or type the existing name into the edit box then press the Rename button.

At the bottom right side of the dialog box are three radio buttons. You can use these to control which names are displayed in the list box. If Normal  is selected then only elements which have not been marked for deletion are displayed. If Deleted is selected then only the names of elements which have been deleted are shown. Select Both to see the names of all elements regardless of whether they are marked for deletion or not.

Elements that have been deleted still occupy space in the library file, can still be pasted and prevent you from using their name for a new element. To remove them completely you must press the Purge button. Before the Purge button has been pressed you can undelete elements: Select either the Deleted or Both radio buttons, click on the element name in the list box or type the name into the edit box then press the Undelete button.


Modify menu
Menu: Modify

Ray...

Element >

Source >

Tape Measure

Protractor

Wavelengths...

Mirror

Rotate

Scale

Move

Pause Trail update

Reset Trails

Auto trace

Link segments

Unlink segments


Modify Rays
Menu: Modify -- Rays

Selecting this menu item starts a dialog box which allows you to change the properties of selected rays either individually or all together.

At the top left of the dialog box are three radio buttons which allow you to specify the colour of the ray(s). Select the colour you want. Rays inherit their colour from their parent ray so this has no effect on child rays. Changing the colour of a parent ray automatically updates the colour of all its children.

At the top right of the dialog box are three radio buttons for options on the arrow position. Select the option you want.

Below this is a box labelled Fertility which contains eight check boxes. The settings of these check boxes define the ray's fertility, i.e. controls which child rays are generated when the ray interacts with an element.

Reflect Always

Checking this option means that a reflected ray will always be generated. This option is mutually exclusive with the next one down.

Reflect if no refraction

Checking this option means that if a refracted ray exists then the reflected ray will not be generated. If a refracted ray does not exist, either because a critical angle is exceeded or because the element is a reflector, then the reflected ray will be generated. This option is mutually exclusive with the previous option.

Refraction

Checking this option will cause any refracted ray to be generated at interfaces of region elements that the ray hits.

Show Normal

Checking this option will cause a dotted "normal" or "perpendicular to the interface" ray to be drawn where-ever the ray intersects with an element. Normals will not be shown if the ray intersects a thin lens or par-axial mirror.

Foward Projection

Checking this option will cause a dash-dot ray to be drawn past the intersection with an element in the same direction as the incident ray. Foward projected rays behave like any other ray and can have their fertility modified etc.

Foward projected rays are useful for comparing what would have happened if an element did not exist to what happens when it does.

Back Projection

The same as Foward projection but in the reverse direction. Back projected rays are useful for showing the position of virtual images.

Parent by reflection

Checking this option will generate a ray which could have given rise to this ray by reflection at the boundary. Useful for backtracking alternative paths in a ray diagram. A ray generated by this option is still considered a child ray.

This option will have no effect if the ray is itself the child of another ray by means of a reflection.

Parent by refraction

Similar to Parent by reflection but for refraction instead.

At the bottom of the dialog box the number of rays selected is indicated as well as the number of the current ray being modified. You can step through all the selected rays, modifying each individually, by using the Next  and Prev buttons. To apply the changes to all the selected rays click on one of the four buttons in the box labelled Apply to all rays .

When you have finished modifying the rays click on Ok.

The undo button only undoes changes made to a single ray, it will not undo an Apply to all rays  button action.


Modify Element
Menu: Modify -- Element >

This item brings up a popup menu. Select the item of interest from below:

Refractive Index...

Lock >

Make Regions

Make Surfaces

Make Shapes

Turn Off

Turn On

Make Converging

Make Diverging

Join

Explode

Group

Ungroup

Remove from group


Modify Source
Menu: Modify -- Source >

This item brings up a popup menu. Select the item of interest from below:

Ray count...

Flip point sources

Unlink snaps


Locking elements
Menu: Modify -- Element > Lock >

You can now lock elements in place so that they cannot be dragged about. This can be useful if you have gone to some trouble to set up an arrangement of elements and don't want to accidentally move them. Also you can lock an element so that it can only be dragged in either the X or Y directions. This is useful if you have a series of lenses positioned on an axis and you want to allow them to be moved only along that axis.

The four menu items in the Modify -- Element > Lock > menu act on all currently selected elements.

Modify -- Element > Lock > Position locks selected element so that they cannot be dragged at all.

Modify -- Element > Lock > X Position locks selected elements so that they can only be dragged in the Y direction.

Modify -- Element > Lock > Y Position locks selected elements so that they can only be dragged in the X direction.

Modify -- Element > Lock > Unlock removes any constraints placed on selected elements by any of the three previous menu items.

If a locked element is part of a group then the lock applies to the group only when that particular element is dragged. For example if a group consists of three elements, the first being locked in position the second being locked to the X axis and the third not being locked then attempting to drag the first element will have no effect. Dragging the second element will move all three elements along the X axis and dragging the third element will allow all three elements to be dragged freely in any direction.


Modify Source Ray Count
Menu: Modify -- Source > Ray Count

Select a source by selecting a ray emanating from it then select this menu item. Enter the new number of rays for this source in the resulting dialog box.

Works for more than one source at a time.


Link segments
Menu: Modify -- Link segments

Sometimes you will need to create two elements which match up along one segment exactly. An example of this is a doublet lens or a lens lying on the interface between two different media. While you can construct elements which match exactly using object snaps, the elements are not normally linked (like sources can be linked to elements) so that if you drag one element (segment) the matching segment does not change, leaving a mis-match.

To overcome this you can "link" segments of different elements. To do this, create the two elements but leave a gap between them. Choose this menu item and then select a segment of an element: Segment_1. A rubberband will attach itself to Segment_1. Select a segment of another element: Segment_2. Both segments must be of the same type, i.e. both line, both arc or both conic segments. Thinlens segments and par-axial mirror segments cannot be linked. Also, the closing line of a region element cannot be linked as a segment.

Segment_1 is the controlling segment. If you drag it in any way then Segment_2 will change to match it. If you drag Segment_2 it will revert to the shape of Segment_1 when you complete the drag.

When raytrace tries to match Segment_2 to Segment_1 it will usually need to change the shape or move one of the elements. After selecting the two segments you will be given two options in a dialog box:

Stretch

If you select this option then Raytrace will modify the shape of the element containing Segment_2 by stretching the preceeding segment. If Segment_2 was the first one created within its element then the action is the same as the Move option.

Move

If you select this option then Raytrace will move the entire element containing Segment_2 so that the starting point of the segments overlay.

For both options the segment following Segment_2 will be stretched to allow matching of the end points of Segment_1 and Segment_2.

Segment links are not copied by the Edit -- Copy or Edit -- Cut commands and therefore cannot be pasted. If you want to copy two elements that are linked then you can do so but you will need to establish the link between the elements if you paste them back into a ray diagram.

Note that the direction in which the segments are drawn can be important. Raytrace will flip a segment around to make the match exact in every sense - including direction. So for example, if you draw two rectangular shaped elements side by side, drawing both in a clockwise sense, and link the two sides which are closest then one of the rectangles will turn into a bow tie shape. To avoid this, plan ahead when drawing the elements or flip one of the elements over using the Mirror command.

You may also use this command to link two arc segments within the one element. You can use this feature to create an equi-convex or equi-concave lens shape.See also: Unlink segments


Unlink segments
Menu: Modify -- Unlink segments

To destroy a link between segments simply select one of the elements involved in the link and choose this menu item.


Group elements
Menu: Modify -- Element > Group

If elements are "grouped" then moving any one of the group by dragging will cause the whole group to move. Grouped elements do not share any properties and are not operated on as a group in any other way.

To group elements simply select the elements you want and use this menu item.

To move one element in the group without moving the others, use the Modify -- Move function.

To add an element to a group:

Select one of the elements in the group and the element to be added

Select Edit -- Select Group to select all the elements already in the group.

Select Modify -- Element > Ungroup to destroy the old grouping.

While all the elements are still selected use Modify -- Element > Group to form the new group which includes the new element.

See also: Modify -- Element > Ungroup, Edit -- Select Group, Modify -- Element > Remove from group


Ungroup elements
Menu: Modify -- Element > Ungroup

To remove the grouping of elements, select any member of the group and use this menu item.See also: Modify -- Element > Remove from group


Remove from group
Menu: Modify -- Element > Remove from group

To remove an element from any group with which it is associated select the element then choose this menu item. See Modify -- Element > Group for information on how to add an element to a group.


Flip Point Source
Menu: Modify -- Source > Flip point sources

Select a point source by selecting a ray emanating from it then select this menu item. The end points defining the source will be swapped. So for example if you define a point source and then realise that you have the end points the wrong way round because the rays spread on the opposite side to what you expected use this menu item to flip the source over.

Works for more than one point source at a time.


Unlink source snaps
Menu: Modify -- Source > Unlink snaps

Select a source by selecting a ray emanating from it then select this menu item. If the source was linked to any elements by object snaps then these links will be removed so that the source no longer moves to follow the elements.

Operates on all selected sources.


Modify -- Element > Refractive Index...
Menu: Modify -- Element > Refractive Index...

This menu item starts a dialog box which allows you to vary the refractive index of all selected elements to the three different colours used in Raytrace. You can change the wavelengths of the three colours using the Modify -- Wavelengths... menu item.

You can either:

Adjust the scroll bars to get the refractive indices that you want.

Enter the desired refractive indices in the relevant edit box next to the scroll bars.

Enter the coefficients of the Cauchy equation for a particular substance (if known).

Select a particular material from one for which the refractive properties have already been set.

To do this, click on the  Material... button and select a material from the list box in the dialog box which appears.

The ray diagram will update as you change the refractive indices unless the Update on Element Drag is unchecked in the Options menu.

The changes affect all selected elements except thin lens and par-axial mirror approximations for which refractive index is meaningless.

Surface and Shape elements have latent refractive indices (since thay can be turned into regions; see Make Regions). These latent refractive indices can be changed using this menu item just like regions.

Click on Ok to accept the changes, click on Cancel to revert to the original values.

If you want to define a new material then either enter the Cauchy coefficients or set the refractive indices at three known wavelengths then click on the Save... button and enter a name for the material in the dialog box which appears. If you use a name of a material which is already defined then the new values will over-write the old ones.


Modify -- Element > Make Regions
Menu: Modify -- Element > Make Regions

Selecting this menu item will turn any selected surface or shape elements into refracting regions. The elements are closed by the addition of line segments. The new regions acquire the latent refractive indices of the surface or shape elements.

See also: Make Surfaces and Make Shapes


Modify -- Element > Make Surfaces
Menu: Modify -- Element > Make Surfaces

Selecting this menu item will turn any selected region or shape elements into reflecting surfaces. Closed regions will be opened by deleteing any line segment that was added to close the element when it was a region. The new surfaces retain the element refractive indices in a latent sense so that changing the elements back to regions will recover their properties completely.


Modify -- Element > Make Shapes
Menu: Modify -- Element > Make Shapes

Selecting this menu item will turn any selected surface or region elements into shape elements. Closed regions will be opened by deleteing any line segment that was added to close the element when it was a region. The new shapes retain the element refractive indices in a latent sense so that changing the elements back to regions will recover their properties completely.

This is quick way of temporarily removing the effect of an element from the ray diagram since rays do not interact with shapes.


Modify -- Element > Turn Off
Menu: Modify -- Element > Turn Off

Choosing this menu item "turns off" any selected elements. The elements will still appear unchanged on the screen but rays will not interact with them in any way. You can use this to see what the effect of removing an element is without modifying the drawing in any other way.

See also: Turn On


Modify -- Wavelengths
Menu: Modify -- Wavelengths

This menu item starts a dialog box which allows you to specify the wavelengths represented by the three colours used in Raytrace. Note that the colours Red, Green Blue refer only to the colours as they are drawn on the screen; the wavelength may represent a different colour in the physical world. The units used are nano-metres.


Modify -- Element > Turn On
Menu: Modify -- Element > Turn On

The opposite of Turn Off.


Modify -- Element > Make Converging
Menu: Modify -- Element > Make Converging

Selecting this menu item will make any selected thin lens elements into converging lenses. The magnitude of the focal length is unchanged.

See also: Make Diverging


Modify -- Element > Make Diverging
Menu: Modify -- Element > Make Diverging

Selecting this menu item will make any selected thin lens elements into diverging lenses. The magnitude of the focal length is unchanged.

See also: Make Converging


Modify -- Element > Join
Menu: Modify -- Element > Join

Selecting this menu item will join all selected region, surface and shape elements into one combined element. The order in which the elements were selected determines the order in which they are joined up. The final element assumes the properties of the first selected element, i.e. region/surface/shape and refractive index properties. Region elements are opened before joining to other elements.

Use this menu item in conjunction with Explode to edit elements that you have already created.


Modify -- Element > Explode
Menu: Modify -- Element > Explode

Selecting this menu item will break apart selected region, surface and shape elements into their individual segments. The position of the segments is not changed so no immediate effect is obvious except that the element will no longer refract rays since it is now really a collection of surfaces positioned end to end. All segments become surface elements after exploding.

Use this menu item in conjunction with Join to edit elements that you have already created.


Modify Tape Measure
Menu: Modify -- Tape Measure...

This item starts a dialog box which presents you with a set of options for how the distance measured by the tape measure is displayed.

Distance

Only the length of the tape measure is displayed - units are drawing units.

Polar (Degrees)

The distance and the direction in degrees are displayed, 0 being horizontal and to the right, positively increasing in anti-clockwise direction.

Polar (Radians)

The distance and the direction in radians are displayed. Angles measured as for the previous option.

Cartesian

The x and y displacements of the tape measure are displayed

None

No readout is displayed. You can use this option to "de-clutter" the display or to create "images" by anchoring a tape measure to two ray intersections - this is how the image is created in the file PLNMIRR.RAY. If the Info -- Readouts menu item is used to copy the readouts of selected tape measures which have this option set then they default to cartesian.

You can also change the number of decimal places used for both distance and angle displays using the + and - minus buttons in the decimal places section of the dialog box.

The Use Leader option if checked causes a leader line to be drawn from the middle of the tape measure line to some other point where the tape measure readout will be displayed. Once this option is set, you can drag the leader to the desired position by selecting the tape measure and dragging the drag handle that appears at the end of the leader.


Modify Protractor
Menu: Modify -- Protractor...

This item starts a dialog box which presents you with a set of options for how the angle measured by the protractor is displayed.

Degrees

The angle is displayed in degrees , 0 being horizontal and to the right, positively increasing in anti-clockwise direction.

Radians

The angle is displayed in radians. Angles measured as for the previous option.

None

No readout is displayed. You can use this option to "de-clutter" the display. If the Info -- Readouts menu item is used to copy the readouts of protractors with this option selected then they default to degrees.

You can also change the number of decimal places used using the + and - minus buttons in the decimal places section of the dialog box.

The Use Leader option if checked causes a leader line to be drawn from the centre point of the protractor to some other point where the protractor readout will be displayed. Once this option is set, you can drag the leader to the desired position by selecting the protractor and dragging the drag handle that appears at the end of the leader.


Mirror operation
Menu: Modify -- Mirror

This menu item allows you to mirror (reflect or flip - call it what you will) the selected objects about some line. You must select the two end points of the mirror line after which the selected objects are flipped about this line.


Rotate operation
Menu: Modify -- Rotate

This menu item allows you to rotate the selected objects about some point either by some specified angle or by dragging with the mouse.

When this menu is selected a dialog box appears: in the upper part of the dialog box you can enter an angle in degrees and click on the Ok button. You must then select the centre point of the rotation in the ray diagram. Angles are measured positive in an anti-clockwise sense.

In the lower part of the dialog box you can click on the "Rotate by dragging" button. If you choose to do this then you must select two points in the ray diagram. The first is the centre of rotation and the second is a reference point. The selected objects will rotate as the mouse is moved such that the line joining the centre point to the reference point will line up with a line drawn between the centre point and the current mouse position.


Scale operation
Menu: Modify -- Scale

This menu item allows you to scale the selected objects by any factor. You must choose the centre of the scale operation and then enter the scale factor. Negative scale factors are allowed - they produce a rotation by 180 degrees as well as scaling.


Move operation
Menu: Modify -- Move

This menu item allows you to move the selected objects by a precise amount. You must choose two points which define the displacement through which the items will be moved. Try using a relative coords snap to specify the displacement.


Reset Trails
Menu: Modify -- Reset Trails

Selecting this menu item erases all trails. It does not delete them. When you subsequently drag the ray diagram the trails will continue to update from the point where they were reset.


Clear menu
Menu: Clear

Items in this menu delete all objects of a specified type from the ray diagram. You can recover from these actions with Edit -- Undo.

All

Deletes everything. See also File -- New

Rays

Deletes all rays and sources from the ray diagram. Is not affected by the state of the Show xxx Rays options.

Void rays

Deletes all void rays.

Elements

Deletes all regions, surfaces and shapes.

Tape Measures

Deletes all tape measures

Protractors

Deletes all protractors.

Annotations

Deletes all annotations.

Trails

Deletes all trails.


Void rays

A void ray is one which no longer exists but still occupies space in the ray diagram database. A record of such a ray is kept because it (and its child rays) may come into existence again. An example of why this is useful:

Suppose you trace a ray through a prism and then through some subsequent optics, eg. a lens. You then drag the incident ray and at some angle of incidence on the prism the ray is totally internally reflected and no longer emerges to pass through the subsequent optics. When you return the ray to its original angle of incidence you would like the ray to propagate as it did before - through the prism and the subsequent optics. Raytrace therefore does not delete the rays that propagated through the subsequent optics when the ray totally internally reflects - instead it makes them void and you never see them unless the ray again emerges from the prism. When this happens all the void rays come back - along with all the information about their fertility etc.

You may want to delete void rays when you run out of ray space so that more useful rays can be created.


Zoom menu
Menu: Zoom

Raytrace does not limit the size of the ray diagram to the visible window. This menu contains items which allow you to scale and move the window about in the ray diagram. You can also pan the ray diagram by using the scroll bars on the side and bottom of the window.

In

Allows you to specify a rectangular region which will expand to fill the Raytrace window. The action depends on the setting of the Freeze Aspect option (see below).

Out

Allows you to specify a rectangular region which the current window will shrink to. The action depends on the setting of the Freeze Aspect option (see below).

Extents

Adjusts the scale of the diagram so that all visible objects fit within the Raytrace window. Objects that are not visible because of the state of items in the Options menu are not included.

Previous

Reverts to the previous zoom scale if there was one.

Reset

Zooms to the same window as that which Raytrace uses by default when it starts. The aspect ratio is one, the coordinate origin is in the bottom left hand corner of the window and the scale is one drawing unit to one display pixel.

Freeze Aspect

Because ray diagrams can sometimes become very "long and thin", raytrace allows the option of changing the horizontal and vertical scale independently (changing the aspect ratio) so that you can see both vertical and horizontal details of the diagram without panning or zooming.

If Freeze Aspect is not checked then the aspect ratio of the display is adjusted whenever you perform a zoom operation. The Raytrace window will map exactly the rectangular region that you choose with Zoom -- In or Zoom -- Out or the extents of the diagram.

If Freeze Aspect is checked then the aspect ratio remains fixed at its current value and the box you drag is constrained to indicate this aspect ratio. If you zoom with the Freeze Aspect option off then the box you drag is unconstrained, allowing you to change the aspect ratio. The aspect ratio is one when Raytrace starts. If you un-check this option and change the aspect ratio by zooming then re-check this option, the aspect ratio will stay fixed at the new value.


Create menu
Menu: Create

Ray

Element

Source

Tape Measure

Protractor

Annotation

Trail

Par-axials on centre

New-style element


Create Ray
Menu: Create -- Ray

Select this menu item to begin drawing rays.

The cursor will change to the start point form - position the cursor where you want the ray to start and click once on the primary mouse button or use a snap. The cursor will then change to the end point form and a rubberband with an arrow head will stretch between the selected starting point and the cursor position. Move the cursor to where you want the ray to end and click the primary mouse button again. The ray will then be drawn using the current default settings.

The cursor returns to the start point form and you can continue to draw rays in the same manner. Once you have drawn all the rays you want, click on the secondary mouse button and select Finished from the popup menu that appears. Raytrace will then calculate and display the paths of all resulting rays.

Notes:

*  You do not have to hold the primary mouse button down while dragging to the end point.

*  You do not have to make rays stop exactly on the edge of any elements that you expect them to interact with, Raytrace will lengthen or shorten rays automatically when they interact with elements.

*  If you want to create several rays with different settings then it is probably better not to change the default settings for each one but rather use the Modify -- Rays... to change the rays after you have drawn them.

*  To create a number of rays coming from a common point or parallel rays use the Create -- Source menu item.

*  Use the othro drag mode to create rays whichare either horizontal or vertical.

*  You can use snaps when creating or dragging rays to specify the position relative to parts of the ray diagram but the rays are not linked to the snap points.


Create Element
Menu: Create -- Element

Important: See the topic Create -- New-style element before reading further. Some information given here applies only if Create -- New-style element is unchecked.

Select this menu item to draw an element.

After selecting this menu item the cursor changes to the start point form. You must select the starting point for the element to be drawn before anything else. The actions you perform next depend upon the type of element you want:

Refracting Region

Draw the shape of the region, remembering that it will be closed automatically. So, for example, it is only necessary to draw two sides of a triangular prism. Click on the secondary mouse button and select Region from the popup. The shape will be closed automatically and filled with the current fill colour.

Note that regions are always closed by the addition of a line segment. You can draw the region as closed manually if you want but you must still tell Raytrace that the element is to be a region otherwise it will treat it as a closed surface.

Reflecting surface

Draw the shape of the surface, click on the secondary mouse button and select Surface from the popup.

Shape

Click on the secondary mouse button and select Shape Only from the popup menu. Draw the shape then click on the secondary mouse button and select Finished from the popup menu.

For help on drawing the shape of an element see : Element segments

Thin lens

Click on the secondary mouse button and select Thin lens F+  (for a converging lens or Thin lens F- for a diverging lens) from the popup menu. The start point selected above is one end of the lens aperture, select the other end of the aperture - the aperture is not drawn at this stage. The cursor now changes to the focus point form. A rubberband stretches from the middle of the lens aperture to the cursor. The length of this rubberband will be the focal length of the lens, the direction is irrelevant. Click on the primary mouse button when you have the desired length. The lens will then be drawn. The principle axis between the focal points is shown by a dashed line. The aperture is shown by a single line with arrowheads at either end. The arrowheads point out for a converging lens and in for a diverging lens. You can change a lens from converging to diverging and vice-versa with the Modify -- Element menu.

Par-axial mirror

You make a par-axial mirror element in the same manner as a thin lens element (see above). When it is drawn a dashed line connects the focal point of the mirror to the middle of the aperture. The aperture is indicated by a single line.

See also: Hints on drawing elements, Overlapping elements


Element hints
Hints on drawing elements

While you can draw elements free-hand, sometimes you will want to create elements either with symmetrical shapes or specific dimensions. For specific dimensions you should use the Abs Coords snap.  For elements with symmetry you should make use of the Copy and Paste facilities in the edit menu and the Mirror, Rotate, Scale, Join facilities in the Modify menu.

For example to create a biconvex lens with the same radius of curvature on both faces:

*  Create a surface consisting of one arc segment with the desired radius.

*  Make a copy of the surface with the Edit -- Copy and Edit -- Paste menu items.

*  Rotate the copied arc 180 degrees using the Modify -- Rotate menu item.

*  Select both the original arc and the rotated copy in that order and use the Modify -- Element > Join menu item.

*  Finally, turn this element into a region using the Modify -- Element > Make Regions.

To create a plano-convex lens, first create a single arc segment surface element and change it to a region. This avoids the problem that Raytrace will only allow you to directly create a region from something with more than one segment. The same thing applies to a region bounded by a single conic segment and its chord.

To delete a segment from an element: explode the element, delete the segment you don't want, select the remaining segments in the order that they should be joined and join them together again. You can insert a segment using the same technique.

Use the Ortho drag mode to create line segments or circular arcs with chords/tangents that are vertical or horizontal.

You can use snaps when creating or dragging elements but the elements will not be linked to the snap points.


Overlapping elements

Raytrace permits elements to overlap. Thus you can have a reflecting surface inside a refracting element or two or more refracting regions overlapping in whole or part. Raytrace resolves the problem of overlapping elements by using "additive" refractive indices. That is, if a point lies within more than one refracting region then the effective refractive index at that point is the sum of the refractive indices of all the elements. This means that you can generate a ray diagram for something like a lens under water so long as you remember that you must subtract out the "background" refractive index of the water when specifying the refractive index of the lens.

There are several other ways in which I could have handled the determination of refractive index at overlaps and later versions of Raytrace may include these as options if there is enough demand.


Element segments

Elements (other than thin lenses and par-axial mirrors) can consist of any number of segments comprising straight lines, circular arcs and conic sections (elliptical, parabolic and hyperbolic arcs). When you first start creating an element Raytrace defaults to straight line segments. You can change to drawing other types of segments as described below.Line segments

To draw straight line segments, click on the secondary mouse buttton and check (select) the item Line Segment in the popup menu. You must specify the end point of the line segment.

Arc segments

To draw arc segments, click on the secondary mouse buttton and check (select) the item Circular Arc in the popup menu. There are a number of methods of specifying an arc. These are outlined below. By default the End/Tangent method is used, you can switch to another method by clicking on the secondary mouse button again. When the popup menu appears the item Circular Arc  should be checked. Selecting this item again brings up another level of popup menu with the various arc drawing method options in it.

End/Tangent

If this item is checked then you must specify an end point and the direction of the tangent to the arc at the start point.

Centre/End

If this item is checked then you must specify a centre point for the arc and an end point. The end point need not lie on the arc. The arc will end where it crosses the line joining the centre and the specified end point. The direction of the arc is specified using the Clockwise arc option.

Radius/End

If this item is checked then you must specify a radius and an end point. The radius is taken as the distance between the start point of the arc and the point you specify when the cursor is in the radius point form. If you specify a radius which is too short to allow the arc to reach the end point then the arc is drawn as a straight line segment - although it retains the ability to be reshaped by dragging.

If either of the last two options is checked then a fourth option specifying the direction of the arc between the start and end points is available:

Clockwise arc

If this is checked then the arc will be drawn in a clockwise sense.

Conic segments

To draw conic segments click on the secondary mouse buttton and check (select) the item Conic Segment in the popup menu. You must select 3 points to define the conic segment.

The focus point. This will be the focus point of the conic section.

The vertex point. This is a point on the axis of the conic section.

The end point. This point defines the direction (relative to the focus) at which the conic segment will end.

It is sometimes hard to visualise what sort of conic you are going to end up with from the position of the start, focus, vertex and end points. If you want a conic with specific constraints then you can apply these after you have drawn some basic approximation. For information on constraining the conic segment in different ways see Conic options.


Conic options

You can adjust a conic segment by dragging the drag handles in the same manner as for arc and line segments. For conics, the four points which are specified over-determine the shape of the segment and one of the points must be adjusted to fit. When creating a conic segment the start, focus and vertex are taken as fixed; the end point you specify only defines a direction relative to the focus not a distance - the end point is moved so that it will lie on the conic segment.

You can change the way Raytrace adjusts the four points (start, focus, vertex and end) to be consistent. To do this, select the element containing the conic segment. Dashed lines are drawn from the start point to the vertex and then from the vertex to the focus. An isolated drag handle appears near the vertex on the opposite side of the conic to the focus drag handle. Click once on this drag handle with the primary mouse button to start the Conic Segment Options dialog box.

There are five options available, click on the radio button beside the one you want.

Focus, End, Axis

The start, focus and end points are used as specified. The vertex defines only the direction of the axis of the conic and will be moved to lie on the conic.

Focus, Vertex, End Angle

The start, focus and vertex points are used as specified. The end point specifies the direction from the focus at which the conic ends. The end point is moved to lie on the conic.

Vertex, Axis, Eccentricity

The start and vertex points are used as specified. In addition the eccentricity is held fixed (see below). The focus point only specifies the direction of the axis relative to the vertex point and the end point only specifies a direction relative to the focus.

Vertex, End, Eccentricity

The start, vertex and end points are used as specified. The eccentricity is held fixed (see below). The focus and axis direction are determined to fit these constraints.

Focus, End, Eccentricity

The start, focus and end points are used as specified. The eccentricity is held fixed (see below). The vertex and axis direction are determined to fit these constraints.

For the last three options you can specify the eccentricity by entering a value in the relevant box.

 An eccentricity of 0 will give a circular arc.

 Values between -1 and +1 (exclusive) will give ellipses. The sign of the eccentricity determines which focus is shown with the drag handle.

A value of 1 will give you a parabola.

A value greater than 1 will give you a hyperbola.

If a value more negative that -1 is entered then it is ignored and the current value is retained. A value of -1 is converted to a value of +1.

Take some care and plan where you put or drag the control points when using parabolas and hyperbolas otherwise you will probably get confused.


Create Source
Menu: Create -- Source

This item brings up a sub menu with two items:

Point

This allows you to create a group of rays that always come from the same point. You specify a number of rays and a centre point followed by an aperture through which the rays will pass. The rays will be drawn in an anti-clockwise direction starting near the first aperture point you select and stopping near the second aperture point you select. The angular spacing of the rays will be even.

Plane

This allows you to create a group of parallel rays. You specify a number of rays, a base point and two aperture points as for a point source. In this case the rays are drawn evenly spaced and parallel to a line joining the base point with the first aperture point.

You can use snaps when creating a source; if you do then the source points will be linked to the snap points.

If you specify the same point for both aperture points then the rays will all be overlayed. This can be useful for generating what looks like a white ray. Rays from sources carry the same attributes as normal rays. They may be modified independently so has to have different colour etc.

Rays emanating from a source may be dragged independently but they will be automatically repositioned when the source is next updated (for example when an object is dragged etc) except as stated below.

You can change the base point of the source by dragging the start of any of the rays emanating from it (and choosing Drag all rays from this source) in the resulting dialog box. You can also change the aperture by dragging the end point of either extreme ray. You can move the entire source by dragging a whole ray emanating from the source. Beware that when you drag the base point or aperture points of a source any links to objects will be lost.

You can delete a source by deleting any one of the rays emanating from it.


Linking to snap points

If you use snap points when creating or dragging sources, tape measures and protractors the points you specify become linked to the snap points.

For example if you specify an end snap when selecting the base point for a source and then drag part of the ray diagram so that the end point moves, the point source will also move. If the snap point is deleted then the linked point will remain where it was when the snap point last existed. If you drag a source point that was created with a snap then the link to the snap point is lost. You can re-establish the link to the same or another snap point simply by specifying a snap when finishing the drag.

Sources can only be linked to snaps that refer to elements.

Tape measures and protractors can be linked to snaps that refer to elements and rays.

Elements and individual rays can not be linked to snaps.


Create Tape Measure
Menu: Create -- Tape Measure

To create a tape measure, select this menu item then select the two end points you want to define the tape measure.

A tape measure is an object which displays the distance between two points in the ray diagram - it is drawn as a straight line with some text over the middle of the line.

Tape measures can be dragged like other objects and can be linked to snaps. You can select a number of options for how the distance is displayed.


New appearances of some objects

Tape measures and protractors are now drawn with a small dot at their end points to make them clearer.

Thin lens and par-axial mirror elements are now drawn with a spot over their foci. This spot is in the same colour as the aperture plane.


Create Protractor
Menu: Create -- Protractor

A protractor is an object which displays the angle subtended by two "end" points relative to a third "centre" point in the ray diagram - lines are drawn joining the centre point to the ends and the angle is displayed near the centre point.

Protractors can be dragged like other objects and can be linked to snaps. You can select a number of options for how the angle is displayed.


Create Annotation
Menu: Create -- Annotation

You can add annotations to your ray diagram using this menu item.

When you  select this menu item a dialog box will appear with space to type in the annotation text. The text must be less than 32 characters long and will appear as a single line of text in the diagram.

Once you have entered the desired text click on Ok. You must then select the base point to which the annotation will be anchored. This may be an snap to an object; if so then the annotation will be dragged along with the object.

After selecting the base point you must specify the leader offset. The annotation will be placed at this point and a leader line will join the text to the base point selected previously. You may select the leader point and the base point as the same, in which case a small dot will appear at the base point.

You can select and drag an annotation as you do other objects.

To change the annotation text first select the annotation. A third drag handle will be displayed near the end of the leader; click on this drag handle to bring up the dialog box for entering the annotation text.


Create Par-axials on centre
Menu: Create -- Par-axials on centre

The default method for defining par-axial type elements is to choose one and of the aperture in response to the "start" cursor followed by the other end of the aperture and then the focal length. If you check this menu item the point you specify in response to the "start" cursor will become the centre of the par-axial element. This is sometimes more convenient if you are trying to line up several lenses.

The setting of this option is not saved with the ray diagram.


New style of element creation
Menu: Create -- New-style element

In response to user feedback a new style of creating elements has been made available. If this menu item is checked the the menu item Create -- Element starts another level of popup menu which allows you to choose the type of element you want to create before you choose the starting point.

To create an element in the new style make sure that Create -- New-style element is checked, then from the Create -- Element popup menu choose the type of element you want. Then choose the start point and create the element in the normal way. When you have finished drawing the element either click on the secondary mouse button and choose Finished or Choose Create -- Element > Finished.

You can cancel the element creation either by clicking on the secondary mouse button and choosing Cancel or choose the menu item Create -- Element > Cancel.

You can undo the last segment either by clicking on the secondary mouse button and choosing Undo segment or by choosing Create -- Element > Undo segment.

The option of using the old style remains to maintain compatibility with the printed manual. When the next edition of the manual is printed it is planned that the old style of element creation will be phased out.


Auto trace
Menu: Modify -- Auto trace

Raytrace allows you to move or drag any point along a pre-defined path. This menuitem allows you to move only a source or ray along a specified path. To drag any point along a path use the Auto drag function.

Moving a point source along a pre-defined path can be useful for generating images of complex objects in a repeatable manner (dragging freehand is not so good).

Select a source (by selecting one or more of the rays coming from the source) or a single ray that doesnot come from a source and also select an element. It is best (but not essential) to choose a "shape" element so that the ray(s) that will be moved do not interact with the element. Choose this menu item. You will be given some options in a dialog box. Choose one of the options and watch Raytrace move the source or ray around the outline of the element. If you have an imaging forming ray diagram then you can attach a trail to the intersection of two rays that form the image and see the shape of the image corresponding to the element outline.

The readouts of any tape measures and protractors will be copied into the clipboard for each point along the outline. Thus you can generate data for say object and image distances for a particular lens and paste the data into a spread sheet for analysis.


Auto drag

Raytrace allows you to move or drag any point along a pre-defined path. You can move a source or ray along a specified path using the Modify -- Auto trace menu item or you can use the auto drag function. To use the auto drag function you must start by dragging the point you want to move manually. Once you have established the dragging you click on the secondary mouse button and select Auto drag from the popup menu. The dragging will be suspended and the cursor will change to the select form. Select any element (preferably a shape) and Raytrace will drag the point along the outline of the element for you. After this manual dragging will resume.

During the automatic dragging the readouts of any tape measures and protractors will be copied into the clipboard for each point along the outline. Thus you can generate data for say object and image distances for a particular lens and paste the data into a spread sheet for analysis.

If you hold the control key down when you select the element along which the dragging will take place the dragging will follow the shape of the element but be offset so as to start from the point where manual dragging left off.


Element
Elements

An element in raytrace is, in general, something with which rays interact. An element can be a closed REGION which can both reflect and refract rays or an open SURFACE which can only reflect. A third type of element called a SHAPE does not interact with rays by reflection or refraction but does interact in the sense that sources can be attached to SHAPES - so when the SHAPE is moved the source also moves. SHAPEs are useful for drawing construction lines and "objects" in the conventional optics sense.

Elements also include "thin lens" and "par-axial spherical mirror" approximations.


Trails

When you drag a ray diagram you get to see where all the interesting points (like images etc) move to. One problem is that the old positions have disappeared and you have to remember what the ray diagram looked like before you dragged it in order to viualise the changes. Trails are a way of overcoming this problem.

A trail is simply a series of line segments that a drawn between the position of a particular "point" (like a ray intersection) in the ray diagram as it is dragged about. You can use trail a to show the image formed of arbitrary object shapes.

See also:  Create -- Trail, Modify -- Reset Trails, Modify -- Pause Trail update, Modify -- Auto trace and Auto drag


Create Trail
Menu: Create -- Trail

When you select this menu item you will be prompted by the cursor to select the point which you want the trail to follow. The point must be an object snap! When the point moves as a result of dragging some part of the ray diagram a trail will be drawn joining the positions occupied by the point as it moves.


Defaults menu
Menu: Defaults

Ray settings...

Child Rays...

Refractive Indices...

Auto drag settings...


Auto drag settings
Menu: Defaults -- Auto drag settings...

Selecting this menu item brings up a dialog box which allows you to set the number of points per segment at which the ray paths are re-calculated during either and auto trace or auto drag function.


Default ray settings
Menu: Defaults -- Ray settings...

Selecting this menu item brings up a dialog box which allows you to set the default colour, arrow position, fertility and length of rays that are to be created by the user. These settings do not apply to rays that Raytrace generates.

The default length setting actually has no effect when the dialog box is started using this menu item.

The affects of the options are explained in the topic: Modify -- Rays...

See also: Defaults -- Child Rays...


Default child ray settings
Menu: Defaults -- Child Rays...

Selecting this menu item brings up a dialog box which allows you to set the default colour, arrow position, fertility and length of rays that are to be created by Raytrace. These settings do not apply to rays that the user draws.

The affects of the options are explained in the topic: Modify -- Rays...

See also: Defaults -- Ray settings...


Default refractive indices
Menu: Defaults -- Refractive Indices...

Selecting this menu item brings up a dialog box which allows you to set the refractive indices for elements that will be created.

Set the values you want either by moving the scroll bars or by entering values directly into the relevant boxes.

Since surface elements and shapes can be turned into regions they have latent refractive indices. These have the value of the defaults at the time they were created.


Options menu
Menu: Options

Colours...

Show >

Grid

Grid size

Snap to grid

Update on Ray Drag

Update on Element Drag

Maximum path depth...

Quiet snap


Show >
Menu: Options -- Show >

Red Rays

Green Rays

Blue Rays

Tape Measures

Protractors

Annotations

Trails


Colours...
Menu: Options -- Colours...

This menu item brings up a dialog box which allows you to set the colours used by Raytrace to draw elements and the background colour. A thumbnail sketch allows you to see the effect of choosing a combination before accepting the settings with Ok or abandoning any selection and sticking with the current colour scheme with Cancel .

The item Par Axials refers to the colour with which the apertures of "Thin lens" and "Par-axial" mirrors are drawn.

Red, green and blue are missing from the colour items because these are reserved for the three ray colours.


Maximum path depth
Menu: Options -- Maximum path depth...

This menu item brings up a dialog box which allows you to control the maximum number of generations of child rays that can spring from any ray. This option is useful for limiting the number of total internal reflections that can occur for example if you start a ray off inside a closed reflector or at greater that a critical angle in a refracting region. The absolute limit on this number is determined by the amount of memory allocated to ray information - at this stage 400 rays regardless of the setting of this option.


Quiet snap
Menu: Options -- Quiet snap

If this menu item is checked then Raytrace will not make sounds to indicate whether or not a snap has been successful.


Show XXX Rays
Menu: Options -- Show > Red (Green or Blue) Rays

These three menu items toggle when selected. They control whether rays of a given colour will be drawn or not. Even when rays are not drawn they are still calculated so that tape measures and protractors which depend upon the rays for position information are updated correctly. The main purpose of these options is to allow you to simplify the ray diagram by hiding rays of which you are not interested in at the time.


Show Tape Measures
Menu: Options -- Show > Tape Measures

This menu item controls whether tape measures are drawn or not. Unchecking the item to turn off tape measures can de-clutter a ray diagram.


Show Trails
Menu: Options -- Show > Trails

This menu item controls whether trails are drawn or not - it does not affect the updating of trails.

See also: Modify -- Pause Trail update


Show Protractors
Menu: Options -- Show > Protractors

This menu item controls whether protractors are drawn or not. Unchecking the item to turn off protractors can de-clutter a ray diagram.


Show Annotations
Menu: Options -- Show > Annotations

This menu item controls whether annotations are drawn or not.


Update on Ray Drag
Menu: Options -- Update on Ray Drag

If this item is checked then Raytrace will "animate" the ray diagram as you drag rays or sources around. If this is slow on your computer then you might like to uncheck this item - in this case Raytrace waits until you finish dragging the rays before it completes the ray paths.

See also: Update on Element Drag


Update on Element Drag
Menu: Options -- Update on Element Drag

If this item is checked then Raytrace will "animate" the ray diagram as you drag elements around. If this is slow on your computer then you might like to uncheck this item - in this case Raytrace waits until you finish dragging the element before it completes the ray paths.

This item also controls whether Raytrace updates the diagram as you change the refractive index of an element or after you have finished changing the refractive index.

See also: Update on Ray Drag


Pause Trails
Menu: Modify -- Pause Trail update

Checking this menu item causes the updating of all trails to be suspended. When the option is subsequently unchecked the trail continues from the new position of the point. Trails can appear as separated segments if this option is used. If you select a trail only the first segment is highlighted by a drag handle.

You can toggle this option simple by pressing the "P" key. So you don't need to stop dragging to generate trails with separate segments.


Info menu
Menu: Info

Identify Point

Physical Length

Optical Length

Readouts


Identify point
Menu: Info -- Identify Point

After selecting this menu item, select a point in the ray diagram (you may use snaps to do so). After selecting the point a message box will appear containing the coordinates of the point as well as the refractive index at that point.

For your convenience, this information is also copied to the clipboard.


Physical Length
Menu: Info -- Physical Length

This menu item causes the physical path length of all selected rays to be summed and displayed in a message box as well as being copied to the clipboard.

See also: Optical Length


Optical Length
Menu: Info -- Optical Length

This menu item causes the optical path length (physical path multiplied by refractive index) of all selected rays to be summed and displayed in a message box as well as being copied to the clipboard.

See also: Physical Length


Copying Readouts
Menu: Info -- Readouts

This menu item causes the readouts of all selected tape measures and protractors to be copied to the clipboard. If the tape measures or protractors have the None option set (see Modify -- Tape Measure then they are treated as if the Cartesian or Degrees options are set.


Primary Mouse Button

The primary mouse button is the one which you use most often in Windows to select from menus etc. It is commonly called the left mouse button. Windows allows you to swap the action of the buttons - useful for left handed people. So to avoid confusion it is referred to as the primary button just to keep the left handers happy.


Secondary Mouse Button

The secondary mouse button is commonly called the right mouse button but Windows allows left-handed people to swap the action of the buttons.


Segment

A segment is a part of an element. Elements can be made up of connected straight line segments, circular arc segments or conic section (parabolic, elliptical or hyperbolic) segments.


Drag Handles

When a ray, element, tape measure or protractor is selected, small square boxes called drag handles are drawn at the vertices and control points of the object. Positioning the "Select" cursor over these boxes and clicking the primary mouse button allows you to drag the vertex or control point to a new position.


Control points

Control points are auxillary points which define the shape of a segment. For example an arc segment requires a start and end point and a direction of the starting tangent, this is supplied by the tangent control point. Conic segments require start, end, vertex and focus points. In addition there is an options control point positioned near the vertex which allows you to change how the conic segment is defined by the position of the four points just mentioned.


Notes on using help

Windows has a reasonably sophisticated help system which allows you to navigate your way around the help information. These are some brief notes on the minimum that you need to know to use Raytrace's help.

If you click on text that appears like this you will jump to a new topic.

If you click on text that looks like this a pop up topic will appear.

You can step through a "browse" sequence of topics by using the browse buttons >> to go to the next topic and << to go back one topic. (Not all topics are part of browse sequences, when this is the case the buttons are dimmed.)

You can search for a topic by keyword by clicking on the Search button.

You can return to the first help topic by clicking on the Contents button.

You can select from a popup list of topics that you have used by clicking on the History button.

For more complete information on using help see: Using Help


Example topic
Topic title

To return to the previous topic click on the Back button.

You can back track like this all the way to where you started if you want.


Example pop up topic
Pop up title

Click in the help window to remove this sort of pop up.


Switching applications
Switching to and from the Raytrace application

As with all Windows applications, you can switch between Raytrace and other applications (such as Help) simply by clicking a mouse button when the cursor is positioned in the window of the application you want. If you have switched away from Raytrace (indicated by the title bar no longer being highlighted) and then click within the Raytrace window, the mouse click that returns you to Raytrace performs no other action; so if nothing happens when you click and you think it should - try clicking a second time.

You are likely to encounter this if you are using Help and switch to the Help window to scroll text or change topics and then want to return to Raytrace.


Using the mouse

The use of the mouse in raytrace is slightly different to many other windows applications. In most applications you need to hold the primary mouse button down while moving the mouse to perform dragging operations etc.

In raytrace there is no need to hold the primary button down while dragging.

Clicking the primary mouse button will begin an operation - for example creating a ray - the mouse can then be moved and the primary button clickeid again to complete the operation.

The cursor in Raytrace generally consists of either a small arrow and a word or a small box and a word. Cursors with an arrow are "point" type cursors, they are a prompt that you are to "point to a point", for example, if you are drawing rays and the cursor consists of an arrow and the word Start then you should point to where you want the ray to start. Cursors with a box are "select" type cursors. You may be selecting an object (ray, element etc) or you may be selecting a point to snap to. Whatever it is that you are trying to select should be positioned so that it passes through or is contained within the box when you click the primary mouse button.

The secondary mouse button is important; it activates a popup menu which allows you to access the various snap types and also options for when you are creating elements. It is also the only pathway to finish some actions such as drawing rays and elements.

When dragging with the mouse you can use two additional modes: Ortho drag mode and Fine drag mode either singly or in combination.


See also: selecting


Child ray

A ray that is produced by Raytrace as a result of the interaction between a ray and an element.


Ortho drag mode

If you hold the control key down while dragging then the drag displacement will be forced to be either horizontal or vertical (whichever passes closest to the cursor position) relative to the point where the primary mouse button was last clicked.

See also: Fine drag mode


Fine drag mode

If you hold the shift key down while dragging then the drag displacement (measured from the point where the shift key was pressed) is reduced by a factor of ten to allow fine dragging.

See also: Ortho drag mode


Parent ray

If a ray (1) produces another ray (2) as a result of an interaction with an element then (1) is called the parent of (2).


Drawn ray

A ray that was originally drawn by the user as distinct from one which was generated by Raytrace.


Tape Measure

An object that displays the distance between two points in a ray diagram.


Protractor

An object that measures an angle in a ray diagram.


Drawn ray

A ray that was originally drawn by the user as distinct from one which was generated by Raytrace.


White ray

Rays in Raytrace are always one of the three colours: red, green or blue. If you want to simulate a white ray, for example, to show dispersion through a prism then you can mimic this by overlaying three rays each with difference colour. The best way to do this is to create a point (or plane) source with three rays and specify the same point for each of the source aperture points. Then select the three rays (all three will be selected at the same time) and change their colours using the Modify -- Ray... menu.